package main

import "fmt"

//父类
type Operfu struct {
	id01 int
	id02 int
}

//加法子类
type jiafazilei struct {
	Operfu
}

//加法子类方法
func (a *jiafazilei) Rist() int {
	return a.id01 + a.id02

}

//减法子类
type janfazilei struct {
	Operfu
}

//减法子类方法
func (s *janfazilei) Rist() int {
	return s.id01 - s.id02

}

func main() {
	//创建加法对象
	var a jiafazilei
	a.id01 = 10
	a.id02 = 20
	v := a.Rist()
	fmt.Println(v)
	var s janfazilei
	s.id01 = 10
	s.id02 = 20
	w := s.Rist()
	fmt.Println(w)
}
